<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试公告汇总系统</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="excel-styles.css">
    <!-- 优先使用本地SheetJS库，如果本地不存在则使用CDN -->
    <script>
        // 检查本地SheetJS库是否已下载并可用
        const isElectron = window.process && window.process.type === 'renderer';
        console.log('检测运行环境 - Electron:', isElectron);
        
        if (isElectron) {
            // 在Electron环境中，优先使用本地文件
            console.log('在Electron环境中，尝试加载本地SheetJS库');
            const script = document.createElement('script');
            script.src = './xlsx.full.min.js';
            script.onload = function() {
                console.log('本地SheetJS库加载成功');
            };
            script.onerror = function() {
                // 如果本地文件加载失败，尝试使用CDN
                console.log('本地SheetJS库加载失败，尝试使用CDN');
                const fallbackScript = document.createElement('script');
                fallbackScript.src = 'https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js';
                fallbackScript.onload = function() {
                    console.log('CDN SheetJS库加载成功');
                };
                fallbackScript.onerror = function() {
                    console.error('无法加载SheetJS库');
                };
                document.head.appendChild(fallbackScript);
            };
            document.head.appendChild(script);
        } else {
            // 在浏览器环境中，直接使用CDN
            console.log('在浏览器环境中，直接使用CDN加载SheetJS库');
            const script = document.createElement('script');
            script.src = 'https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js';
            script.onload = function() {
                console.log('CDN SheetJS库加载成功');
            };
            script.onerror = function() {
                console.error('CDN SheetJS库加载失败');
            };
            document.head.appendChild(script);
        }
    </script>
</head>
<body>
    <div class="container">
        <!-- 搜索区域 -->
        <div class="search-container">
            <input type="text" id="searchInput" class="search-input" placeholder="输入专业或学历进行搜索...">
            <div class="search-icon">🔍</div>
        </div>

        <!-- 加载状态 -->
        <div id="loadingState" class="loading-state">
            <div class="loading-spinner"></div>
            <p>正在加载考试公告...</p>
        </div>

        <!-- 错误状态 -->
        <div id="errorState" class="error-state" style="display: none;">
            <div class="error-icon">⚠️</div>
            <p id="errorMessage">加载失败，请检查网络连接</p>
            <button id="retryButton" class="retry-button">重试</button>
        </div>

        <!-- 无数据状态 -->
        <div id="noDataState" class="no-data-state" style="display: none;">
            <div class="no-data-icon">📝</div>
            <p>暂无符合条件的考试公告</p>
        </div>

        <!-- 公告列表容器 -->
        <main class="main-content">
            <div id="announcementList" class="announcement-list">
                <!-- 动态生成的公告卡片将在这里显示 -->
            </div>
        </main>
    </div>

    <script src="app.js"></script>
</body>
</html>